<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script>
window.onload=function ()
{
	var oBtn=document.getElementById('btn1');
	
	//attachEvent(事件名， 函数)
	//IE
	/*
	oBtn.attachEvent('onclick', function ()
	{
		alert('a');
	});
	oBtn.attachEvent('onclick', function ()
	{
		alert('b');
	});
	*/
	
	//FF
	//addEventListener(事件名, 函数, false)
	oBtn.addEventListener('click', function ()
	{
		alert('a');
	}, false);
	oBtn.addEventListener('click', function ()
	{
		alert('b');
	}, false);
	
	/*
	oBtn.onclick=function ()
	{
		alert('a');
	};
	
	oBtn.onclick=function ()
	{
		alert('b');
	};*/
};
</script>
</head>

<body>
<input id="btn1" type="button" value="按钮" />
</body>
</html>
